home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / JApplet.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  4.4 KB  |  165 lines

  1. package javax.swing;
  2.  
  3. import java.applet.Applet;
  4. import java.awt.AWTEvent;
  5. import java.awt.BorderLayout;
  6. import java.awt.Color;
  7. import java.awt.Component;
  8. import java.awt.Container;
  9. import java.awt.Graphics;
  10. import java.awt.LayoutManager;
  11. import java.awt.event.InputEvent;
  12. import java.awt.event.KeyEvent;
  13. import javax.accessibility.Accessible;
  14. import javax.accessibility.AccessibleContext;
  15.  
  16. public class JApplet extends Applet implements Accessible, RootPaneContainer {
  17.    protected JRootPane rootPane;
  18.    protected boolean rootPaneCheckingEnabled = false;
  19.    protected AccessibleContext accessibleContext = null;
  20.  
  21.    public JApplet() {
  22.       TimerQueue var1 = TimerQueue.sharedInstance();
  23.       if (var1 != null) {
  24.          synchronized(var1){}
  25.  
  26.          try {
  27.             if (!var1.running) {
  28.                var1.start();
  29.             }
  30.          } catch (Throwable var4) {
  31.             throw var4;
  32.          }
  33.       }
  34.  
  35.       ((Component)this).setForeground(Color.black);
  36.       ((Component)this).setBackground(Color.white);
  37.       this.setLayout(new BorderLayout());
  38.       this.setRootPane(this.createRootPane());
  39.       this.setRootPaneCheckingEnabled(true);
  40.    }
  41.  
  42.    protected void addImpl(Component var1, Object var2, int var3) {
  43.       if (this.isRootPaneCheckingEnabled()) {
  44.          throw this.createRootPaneException("add");
  45.       } else {
  46.          super.addImpl(var1, var2, var3);
  47.       }
  48.    }
  49.  
  50.    protected JRootPane createRootPane() {
  51.       return new JRootPane();
  52.    }
  53.  
  54.    private Error createRootPaneException(String var1) {
  55.       String var2 = this.getClass().getName();
  56.       return new Error("Do not use " + var2 + "." + var1 + "() use " + var2 + ".getContentPane()." + var1 + "() instead");
  57.    }
  58.  
  59.    public AccessibleContext getAccessibleContext() {
  60.       if (this.accessibleContext == null) {
  61.          this.accessibleContext = new AccessibleJApplet(this);
  62.       }
  63.  
  64.       return this.accessibleContext;
  65.    }
  66.  
  67.    public Container getContentPane() {
  68.       return this.getRootPane().getContentPane();
  69.    }
  70.  
  71.    public Component getGlassPane() {
  72.       return this.getRootPane().getGlassPane();
  73.    }
  74.  
  75.    public JMenuBar getJMenuBar() {
  76.       return this.getRootPane().getMenuBar();
  77.    }
  78.  
  79.    public JLayeredPane getLayeredPane() {
  80.       return this.getRootPane().getLayeredPane();
  81.    }
  82.  
  83.    public JRootPane getRootPane() {
  84.       return this.rootPane;
  85.    }
  86.  
  87.    protected boolean isRootPaneCheckingEnabled() {
  88.       return this.rootPaneCheckingEnabled;
  89.    }
  90.  
  91.    protected String paramString() {
  92.       String var1 = this.rootPane != null ? this.rootPane.toString() : "";
  93.       String var2 = this.rootPaneCheckingEnabled ? "true" : "false";
  94.       return super.paramString() + ",rootPane=" + var1 + ",rootPaneCheckingEnabled=" + var2;
  95.    }
  96.  
  97.    protected void processKeyEvent(KeyEvent var1) {
  98.       super.processKeyEvent(var1);
  99.       if (!((InputEvent)var1).isConsumed()) {
  100.          JComponent.processKeyBindingsForAllComponents(var1, this, ((AWTEvent)var1).getID() == 401);
  101.       }
  102.  
  103.    }
  104.  
  105.    public void remove(Component var1) {
  106.       if (var1 == this.rootPane) {
  107.          super.remove(var1);
  108.       } else {
  109.          this.getContentPane().remove(var1);
  110.       }
  111.  
  112.    }
  113.  
  114.    public void setContentPane(Container var1) {
  115.       this.getRootPane().setContentPane(var1);
  116.    }
  117.  
  118.    public void setGlassPane(Component var1) {
  119.       this.getRootPane().setGlassPane(var1);
  120.    }
  121.  
  122.    public void setJMenuBar(JMenuBar var1) {
  123.       this.getRootPane().setMenuBar(var1);
  124.    }
  125.  
  126.    public void setLayeredPane(JLayeredPane var1) {
  127.       this.getRootPane().setLayeredPane(var1);
  128.    }
  129.  
  130.    public void setLayout(LayoutManager var1) {
  131.       if (this.isRootPaneCheckingEnabled()) {
  132.          throw this.createRootPaneException("setLayout");
  133.       } else {
  134.          super.setLayout(var1);
  135.       }
  136.    }
  137.  
  138.    protected void setRootPane(JRootPane var1) {
  139.       if (this.rootPane != null) {
  140.          this.remove(this.rootPane);
  141.       }
  142.  
  143.       this.rootPane = var1;
  144.       if (this.rootPane != null) {
  145.          boolean var2 = this.isRootPaneCheckingEnabled();
  146.  
  147.          try {
  148.             this.setRootPaneCheckingEnabled(false);
  149.             ((Container)this).add(this.rootPane, "Center");
  150.          } finally {
  151.             this.setRootPaneCheckingEnabled(var2);
  152.          }
  153.       }
  154.  
  155.    }
  156.  
  157.    protected void setRootPaneCheckingEnabled(boolean var1) {
  158.       this.rootPaneCheckingEnabled = var1;
  159.    }
  160.  
  161.    public void update(Graphics var1) {
  162.       ((Container)this).paint(var1);
  163.    }
  164. }
  165.